<div class="row">
  <div class="col-sm-11">
    <h2><%= display_name_plural %></h2>
  </div>
  <div class="col-sm-1">
    <a class="btn btn-success btn-sm" href="/<%= name_plural %>/new">New</a>
  </div>
</div>

<div class="table-responsive">
  <table class="table table-striped">
    <thead>
      <tr>
<% @fields.reject{|f| f.hidden }.each do |field| -%>
        <th><%= field.name.capitalize %></th>
<% end -%>
        <th>Actions</th>
      </tr>
    <tbody>
    <%="<"%>%- <%= name_plural %>.each do |<%= @name %>| %>
      <tr>
<% @fields.reject{|f| f.hidden }.each do |field| -%>
        <td><%="<"%>%= <%= @name %>.<%= field.name %><% if field.reference? %>.id<% end %> %></td>
<% end -%>
        <td>
          <span>
            <%="<"%>%= link_to("Show", "/<%= name_plural %>/#{<%= @name %>.id}", class: "btn btn-info btn-sm") -%>
            <%="<"%>%= link_to("Edit", "/<%= name_plural %>/#{<%= @name %>.id}/edit", class: "btn btn-success btn-sm") -%>
            <%="<"%>%= link_to("Delete", "/<%= name_plural %>/#{<%= @name %>.id}?_csrf=#{csrf_token}", "data-method": "delete", "data-confirm": "Are you sure?", class: "btn btn-danger btn-sm") -%>
          </span>
        </td>
      </tr>
    <%="<"%>%- end %>
    </tbody>
  </table>
</div>
